package com.bookpavilion.article.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.bookpavilion.article.pojo.Article;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * 数据访问接口
 * @author Administrator
 *
 */
public interface ArticleDao extends JpaRepository<Article,String>,JpaSpecificationExecutor<Article>{
	@Modifying
    @Query("update Article set thumb_nums=thumb_nums+?2 where id=?1")
    public int updateThumbNums(String id,int num);

	@Modifying
    @Query("update Article set comment_nums = comment_nums+?2 where id=?1")
    public int updateCommentNums(String id,int num);

	@Modifying
    @Query("update Article set collection_nums=collection_nums+?2 where id=?1")
	public int updateCollectionNums(String id,int num);
}
